from params import priorities

orders_count = 0


def orders_count_increment():
    global orders_count
    orders_count += 1


class Order:
    def __init__(self, up, priority: int, time: int):
        """
        :param up: UnloadingPoint
        :param priority:
        :param time:
        """
        global orders_count
        self.id = orders_count
        self.up = up
        self.priority = priority
        self.time = time

    @property
    def expire_time(self):
        return self.time + priorities[self.priority][0]

    @property
    def site(self):
        return self.up.x, self.up.y

    @property
    def belongs_to(self):
        return self.up.id

    def __str__(self):
        return f'Order(id={self.id}, From={self.belongs_to}, GTime={self.time}, Priority={self.priority})'

    def __repr__(self):
        return self.__str__()